<#define __LAMPATH__="{{LAM.classPath}}" />
<#define __SERVER__="{{LAM.SERVER}}" />
<#define __DATAPATH__="{{LAM.DATA}}" />
<#define __INDEX__="{{LAM.INDEX}}" />
<#define __CSS__="{{LAM.CSS}}" />
<#define __PLUGINS__="{{LAM.PLUGINS}}" />
<#define __CLASSPATH__="{{LAM.classPath}}" />
<#define __COMPONENTS__="{{LAM.COMPONENTS}}" />


#define# __DATA__ <#include repeat="0" tp-data="{}"  file="__SERVER__/sorts/index" /> #end#
#define# __DATA_LIST__ <#include repeat="0" tp-data="{}"  file="__SERVER__/url/index" /> #end#

<#import path="/base/Cache.class,/base/Storage.class" root="__LAMPATH__" write="1" befor="1" />
<#import type="css" path="/tree" root="__CSS__" befor="1" />

<#define _TITLE_="网页地址" />


<#Block:begin id="title" data="{'title':'_TITLE_'}"><#Block:end>

<#extends title="_TITLE_" data="{'list':[
{'name':'网页地址','href':'###','title':''},
{'name':'网页地址','href':'###','title':''},
{'name':'_TITLE_'}
]}" />

<#beginBlock id="crumb" data="{'list':[
{'name':'网页地址','href':'###','title':''},
{'name':'网页地址','href':'###','title':''},
{'name':'_TITLE_'}
]}">
<#endBlock>



<#Block:begin id="left_side_menu" data="{'list':[{'id':0,'name':'name','child':[]}], level: 0}">
    <%LAM.each(list,function(i){%>
        <%if (0 == level){%>
            <dl class="border dl-1">
                <dd class="dd-1 <%if(0 === i){%>cur<%}%>">
                    <div class="title" v-on:click="getContent($event, <%=this.id%>)" data-id="<%=this.id%>"><%=this.name%></div>
                    <%if(System.isArray(this.child)){%><div class="sectionIcon-A1 sectionIcon-A1-5 sectionIcon-A1-5-1"><i></i></div><%}%>
                </dd>
                <%if(System.isArray(this.child)){%>
                    <%=LAM.Template.getBlock('left_side_menu',{list:this.child, level: 1})%>
                <%}%>
            </dl>
        <%} else {%>
            <dd class="dd-1" style="border-left: 1px solid #ccc;">
                <div class="title" v-on:click="getContent($event, <%=this.id%>)" data-id="<%=this.id%>"><%=this.name%></div>
                <%if(System.isArray(this.child)){%>
                    <dl class="ml5"><%=LAM.Template.getBlock('left_side_menu',{list:this.child, level: 1})%></dl>
                <%}%>
            </dd>
        <%}%>
    <%});%>
<#Block:end>

<#Block:begin id="empower_menu" data="{'list':[{'id':0,'name':'name','child':[]}]}">
<div class="sectionMenu-A1 sectionMenu-A1-3 j_sectionMenuA1 mCustomScrollbar" id="address_menu" data-mcs-theme="dark">
    <%=LAM.Template.getBlock('left_side_menu',{list:list, level: 0})%>
</div>
<#Block:end>



<#Block:begin id="empower_search" data="{}">
<ul class="sectionTitle-A5 sectionTitle-A5-p0 clear mb10 sectionForm-A1 sectionForm-A1-1 sectionForm-A1-2 sectionFloat">
    <li class="mr20">
        <span class="mr5"><input class="v-negative3 js_allcheckbok" type="checkbox"></span>
        <span>全选当前商品</strong>
    </li>
    <li class="mr20">
        <label class="L w-auto">设置授权过期时间：</label>
        <input type="text" class="text w-160 L" value="" placeholder="请输入商品名称">
    </li>
    <li class="">
        <label class="L w-auto">过期提醒：</label>
        <input type="text" class="text w-160 L" value="" placeholder="请输入商品名称">
    </li>
    <li class="R sectionButton-B1">
        <a href="__INDEX__url/create"><button type="button" class="btn">添加</button></a>
    </li>
</ul>
<#Block:end>
<#Block:begin id="empower" data="{}">
<div id="vue_url_index">
    <div class="sectionWrap-A7 p-rel">
        <#=block id="empower_menu" data="{'list':__DATA__}" />

        <div class="sectionWrap-A6">
            <div class="j_sectionBlock p-rel sectionBorder-A4 ">
                <div class="p25">

                    <#=block id="empower_search" />
                    <div class="sectionFloat sectionWrap-A17 mb10">
                        <ul class="clear">
                            <li v-for="(item, index) in contents" class="L mr5 mb10 sectionButton-B1 sectionButton-B1-big">
                                <div class="btn">
                                    <a :href="item.url" target="_blank">${ item.name }</a>
                                    <a v-on:click="modify(item.id)">修改</a>
                                    <a v-on:click="remove(item.id)" href="javascript:void(0)">删除</a>
                                </div>
                            </li>
                        </ul>
                    </div>


                    <div class="sectionPageing-A2 clear mb20">
                        <div class="R">
                            <#include repeat="0" tp-data="{}"  file="{{LAM.COMPONENTS}}/paging.html" />
                        </div>
                    </div>

                    <div class="sectionTitle-A5 sectionTitle-A5-p0 clear">
                        <div class="L">
                            <span class="mr5"><input class="v-negative3 js_allcheckbok" type="checkbox"></span>
                            <span>全选当前商品</strong>
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<#Block:end>

<script type="text/javascript">

    LAM.run([jQuery],function($) {
        'use strict';
        var System = this;

        var cache = new System.Cache('url');
        var tools =new System.Tools();



        $(function(){

            LAM.GVue = new Vue({
                'el': '#vue_url_index',
                'delimiters': ['${','}'],
                'data': {
                    'list': __DATA__,
                    'contents': []
                },
                'methods': {
                    'getContent': function(e, sid){
                        var vue = this;
                        cache.find('id',sid,function (index,sid) {
                            var _this = this;
                            var list=null;
                            if(-1 === index){
                                var wait = layer.load();
                                $.get('__SERVER__/url/index',{
                                    'sid':sid
                                },function(D){
                                    layer.close(wait);
                                    if(D.status){
                                        list = D.data;
                                        vue.contents = list;
                                        _this.add({list:list});
                                    }else{
                                        list = "没有数据";
                                    }

                                },'json');
                            }else{
                                vue.contents = this.get(index).list;
                            }
                            var name = $('#address_menu [data-id="'+sid+'"]').text();
                            $("#crumb strong").text(name);

                        });
                        
                    },
                    'remove': function(id){
                        layer.confirm('真的要删除吗？？？', {icon: 3, title:'提示'}, function(index){
                          //do something
                          System.redirect('__INDEX__url/delete&id=' + id);
                          layer.close(index);
                        });
                    },
                    'modify': function(id){
                        System.redirect('__INDEX__url/edit&id=' + id);
                    }
                },
                'watch': {

                }
            });

            $('.sectionTitle-A5 [type="checkbox"]').on('click',function () {
                tools.checkboxSelectAll($('.sectionWrap-A17 input[type="checkbox"]'),this);

            });





            
            System.COOKIE.find('id',"1",function (index) {
                if(-1 !== index){
                    var sid = this.get(index).sid;
                    if(sid > 0){
                        System.wait(function () {
                            $('#address_menu [data-id="'+sid+'"]').trigger('click');
                        },1);


                    }

                }
            });
            new System.Tab({
                'list':$('#address_menu .dd-1'),
                'event':'click',
                'class':'cur',
                'or':true,
                'fn':function () {
                    var id = $(this).find('[data-id]').data('id');
                    var name = $(this).find('[data-id]').text();
                    $("#mCSB_2_container").css("top", -this.offsetTop);
                    System.COOKIE.find('id',"1",function (index) {
                        if(-1 !== index){
                            var data = this.get(index);
                            data.sid = id;
                            data.sort_name = name;
                            this.update(index,data);
                        }
                    });
                }
            }).run();



        });
    });
</script>
<#=block id="empower" />
<style type="text/css">
    

    .sectionButton-B1 .btn a{color:#fff;}

</style>



